import requestMeeting, { request, fetchAxios } from '@/plugins/axios'
import { FetchResApi, RecordProgram } from './interface'
/** 获取vrs_address */
export const fetchGetVrsAddress = async () =>
	requestMeeting<any>({
		url: '/vrs_address',
		method: 'get',
	}).then((res) => res)

/** 获取vrs */
export const fetchGetVrsProgram = async (
	address: string,
	params: { sso_token: string; meetingmoid: string; prgs1page: number }
) =>
	request<FetchResApi<RecordProgram[]>>({
		url: '/api/v1/vrs/program',
		method: 'get',
		params: params,
		headers: {
			'mo-proxy-vrs': address,
		},
	}).then((res) => res)

/** 下载会议录像 */
export const fetchDownLoadVrs = async (streamjsonpath: string) =>
	fetchAxios({
		url: `/meetingspace/vrs_file`,
		method: 'get',
		params: { url: streamjsonpath, prgname: 'Readme.json' },
		responseType: 'arraybuffer',
	}).then((res) => res)
